<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title>数据同步</title>
		<s:include value="/system/path.jsp"></s:include>
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<link rel="stylesheet" type="text/css"
			href="${contextPath}/resource/css/default.css" />
			<script type="text/javascript" src="${contextPath}/resource/tree/jquery-1.4.2.js"></script>
		 <script src="${contextPath}/resource/js/eqpMait.js"></script>
		<script src="${contextPath}/resource/js/index.js"></script>
		<script src="${contextPath}/resource/js/systemUtil.js"></script>

        <SCRIPT type="text/javascript">
                function submitInfo(type){
                  //synModels
                  if(selected()){
		    		// if(confirm("同步开始?")){}else{return;}
		    		if(type==1){
		    		   document.syncroinzedDataForm.attributes["action"].value = "synchronizedDataAction_systemSyn.do"; 
		    		}
		    		 document.syncroinzedDataForm.submit();
		    		 if(document.getElementById("synchronizedDIV") && document.getElementById("buttonDIV")){
		    		     $("#buttonDIV").fadeOut("slow"); 
		    		     $("#synchronizedDIV").fadeIn("slow"); 
		    		 }
		    	  }else{
		    		 alert("请选择需要同步的模块!");
		    		 return ;
		    	  }
                }
                
                //是否选中复选框值
			   function selected() {
					for (var i = 0; i < document.all.length; i++) {
					if (document.all[i].tagName.toUpperCase() == "INPUT") {
						var tmp = document.all[i].type.toUpperCase();
						var name = document.all[i].name;
						if ((tmp == "CHECKBOX") && (document.all[i].checked == true) && (name == "synModels")) {
							return true;
						}
					}
				}
				return false;
			  }
        
        </SCRIPT>
        
	</head>

	<body>
		<s:form action="synchronizedDataAction_syncroinzedData.do" method="post" name="syncroinzedDataForm">
			<table class="menu_table">
				<tr>
					<th>
						同步管理 &gt;&gt;数据同步设置
					</th>
				</tr>
			</table>
			<div class="listtable">
				<div class="secondDiv">
					<table class="form_table" width="100%">
							<tr>
								<th align="center" style="font-weight: bold;">同步模块:</th>
								<td colspan="3" id="checktd">
									<s:checkboxlist list="synchronizedTable" name="synModels"></s:checkboxlist>
								</td>
								<script type="text/javascript"> 
									   
									    //得到checkboxlist的td,自定义td的id为checktd 
										var checktd = document.getElementById("checktd"); 
										//得到一个checkbox数组 
										var checkboxs = checktd.getElementsByTagName("input"); 
										//最前面不需要br 从1开始 
										for ( var i = 1; i < checkboxs.length; i++) { 
										    //每个br只能用一次,所以在循环内创建 
											var br = document.createElement("br"); 
											var br1 = document.createElement("br"); 
										     if(parseInt(i)%parseInt(4)==0){
										       checktd.insertBefore(br, checkboxs[i]); //checkbos前插入br 
										       checktd.insertBefore(br1, checkboxs[i]); //checkbos前插入br 
										     }
									    }   
									</script>
								
						  </tr>
					</table>
					</br>
				  <table width="50%" border="0" align="center" cellpadding="3" cellspacing="1">
				    <tr>
				      <td align="center"  >
				         <div align="center">
				           <s:if test="synType==1">
				               <input type="button" value="保存同步" onclick="javascript:submitInfo(1)"/>
				               <script>
				                    
				               </script>
				           </s:if>
				           <s:else>
				                    <div id="buttonDIV">
				                         <input type="button" value="开始同步" onclick="javascript:submitInfo(0)"/>
				                    </div>
					                <div id="synchronizedDIV" style="display: none;">
					                    <table border=0 cellpadding=0 cellspacing=0 width="70%" height="50%">
											<tr height="5">
												<td>&nbsp;</td>
												<td>&nbsp;</td>
											</tr>
											<tr height="80" >
												<td align="left"  colspan="2" class="tdcontent"> 
												   <div id="result">
												 	     <MARQUEE behavior='alternate'  align='center'  direction='right' scrollamount='５'>
												        <FONT color="#75d2eb" size="5"><STRONG>数据正在同步......</STRONG></FONT> 
												        &nbsp; 
											            </MARQUEE>
												   </div>
											   </td>
											</tr>
		                                </table>
					                </div>
				           </s:else>
				          
				        </div>
				        </td>
				    </tr>
		          </table>
		          </br></br></br></br></br></br> 
				</div>
			</div>
		</s:form>
	</body>
</html>
